<?php
class Chanel_Model_Like extends Zend_Db_Table
{
        protected $_name="likechanel";
        protected $_primary = 'id';
	   
    public function insertLike($arrParam = null, $option = null)
  	{
  		$row = $this->fetchNew();		  	
		$row->userid       =$arrParam['userid'];
		$row->chanelid           =$arrParam['chanelid'];		
		$row->status       =$arrParam['status'];		
		$row->createdate       =$arrParam['createdate'];
	  	return $row->save();
  	}
  	
  	public function countLike($chanelid, $status){

  		$db = Zend_Registry::get('connectDB');
  		$count = $db->fetchOne("SELECT COUNT(*) AS count FROM likechanel WHERE chanelid='".$chanelid."'" );
  		
  		return number_format($count);
  		
  	}
  	
	public function ischeckLike($chanelid,$userid){
		
		$db = Zend_Registry::get('connectDB');
  		$count = $db->fetchOne("SELECT COUNT(*) AS count FROM likechanel WHERE chanelid='".$chanelid."'" );
  		
  		return $count;
		
	}
	
  	
  	
  	
  	
}